package com.wpzf.ndhc.service.impl;


import com.wpzf.common.core.web.domain.AjaxResult;
import com.wpzf.ndhc.utils.TableUtil;
import com.wpzf.ndhc.domain.WpCjTbhcjgDTO;
import com.wpzf.ndhc.mapper.WpzfNdhcShTbMapper;
import com.wpzf.ndhc.service.WpzfNdhcShTbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;

import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class WpzfNdhcShTbServiceImpl implements WpzfNdhcShTbService
{

    @Autowired
    WpzfNdhcShTbMapper wpzfNdhcShTbMapper;

    @Override
    public int addShTb(Map<String, Object> parms) {
        parms = TableUtil.TableName(parms);
        return wpzfNdhcShTbMapper.addShTb(parms);
    }
    @Override
    public int deleteTb(Map<String, Object> parms)
    {
        parms = TableUtil.TableName(parms);
        return wpzfNdhcShTbMapper.deleteTb(parms);
    }

    @Override
    public Map<String, Object> querybytbbh(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.querybytbbh(parm);
    }

    @Override
    public List<Map<String, Object>> queryShtbTask(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.queryShtbTask(parm);
    }

    @Override
    public Integer queryShtbTaskCount(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.queryShtbTaskCount(parm);
    }

    @Override
    public List<Map<String, Object>> get_sh_pchlist(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.get_sh_pchlist(parm);
    }

    @Override
    public List<Map<String, Object>> query_sh_Provs(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.query_sh_Provs(parm);
    }

    @Override
    public List<Map<String, Object>> query_sh_Citys(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.query_sh_Citys(parm);
    }

    @Override
    public List<Map<String, Object>> getShtbLeftlist(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.getShtbLeftlist(parm);
    }

    @Override
    public WpCjTbhcjgDTO getShtbZzjg(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.getShtbZzjg(parm);
    }

    @Override
    public Integer updateShState(Map<String, Object> parm) {
        return wpzfNdhcShTbMapper.updateShState(parm);
    }

    @Override
    public List<Map<String, Object>> query_sh_task_list(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.query_sh_task_list(parm);
    }

    @Override
    public List<Map<String, Object>> getHcjgsmList(Map<String, Object> parm) {
        parm = TableUtil.TableName(parm);
        return wpzfNdhcShTbMapper.getHcjgsmList(parm);
    }








    @Override
    public List<Map<String, Object>> getPch(Map<String, Object> param) {
        return wpzfNdhcShTbMapper.getPch(param);
    }

    @Override
    public List<Map<String, Object>> getSheng(Map<String, Object> param) {
        return wpzfNdhcShTbMapper.getSheng(param);
    }

    @Override
    public List<Map<String, Object>> getXian(Map<String, Object> param) {
        return wpzfNdhcShTbMapper.getXian(param);
    }

    @Override
    public List<Map<String, Object>> queryDkTask(Map<String, Object> param) {
        return wpzfNdhcShTbMapper.queryDkTask(param);
    }

    @Override
    public Integer queryDkTaskCount(Map<String, Object> param) {
        return wpzfNdhcShTbMapper.queryDkTaskCount(param);
    }

    @Override
    public List<Map<String, Object>> queryDkTaskByIndex(Map<String, Object> param) {
        return wpzfNdhcShTbMapper.queryDkTaskByIndex(param);
    }

    @Override
    @Transactional
    public Integer correction(Map<String, Object> param) {
        Integer rest = 0;

//        map.put("tbbh", parms.get("tbbh") + "");
//        map.put("xzqdm", parms.get("xzqdm") + "");
//        map.put("pdlx", parms.get("pdlx") + "");
//        map.put("pch", parms.get("pch") + "");
//        map.put("zgyy", parms.get("zgyy") + "");
//        map.put("ywhj", parms.get("ywhj") + "");
        param.put("submitdate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((new Date()).getTime()));
        param.put("sfzg", "否");
        param.put("state", "0");

        wpzfNdhcShTbMapper.updateZgState(param);
        return wpzfNdhcShTbMapper.correction(param);
    }
}
